package vfs.service;

import java.util.Iterator;
import vfs.filter.VFSFilter;
import vfs.obj.entity.VFSNodeType;

/**
 *
 * @author Matthew Eavenson <durandal@uga.edu>
 * 
 */
public interface VFSNodeTypeService {
    
    /**
     * Returns a node type with the given name.
     * 
     * @param name the requested node type's name
     * @return the node type with the given name if it exists, null otherwise
     */
    VFSNodeType getNodeType(String name);
    
    /**
     * Returns an iterator over node types, given a filter.
     * 
     * @param filter the filter over the node type query
     * @return an iterator over any node types that fit the given filter
     */
    Iterator<VFSNodeType> getNodeTypes(VFSFilter filter);
    
    /**
     * Returns whether a node type exists.
     * 
     * @param name the name of the node type
     * @return true if the node type exists, false otherwise
     */
    boolean exists(String name);
    
    /**
     * Creates a new node type.
     * 
     * @param name the new node type's name
     * @param description the new node type's description (optional)
     * @return a newly created node type
     */
    VFSNodeType create(String name, String description);
    
    /**
     * Renames a given node type.
     * 
     * @param nodeType the node type to be renamed
     * @param name the new name of the given node type
     * @return true if the node type was renamed successfully, false otherwise
     */
    boolean rename(VFSNodeType nodeType, String name);
    
    /**
     * Removes a node type with the given name.
     * 
     * @param name the name of the node type to be removed
     * @return true if the node type was removed successfully, false otherwise
     */
    boolean remove(String name);
    
    /**
     * Removes a node type.
     * 
     * @param nodeType the node type to be removed
     * @return true if the node type was removed successfully, false otherwise
     */
    boolean remove(VFSNodeType nodeType);
    
}
